﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dbcaac
{
    /// <summary>
    /// 数据实体的简单工厂
    /// </summary>
    public static class EntityFactory
    {
        public static EntityBase getEntity(string pageName)
        {
            if (string.IsNullOrEmpty(pageName))
            {
                ExceptionHelper.Throw404Exception();
            }

            EntityBase entity = null;
            switch (pageName.ToUpper())
            {
                case "JIYUANXM":        // 基元项目
                    entity = new EntityJiyuanXM();
                    break;

                case "JIYUANNR":        // 基元内容
                    entity = new EntityJiyuanNR();
                    break;

                case "JIYUANNRSH":
                    entity = new EntityJiyuanNRSH();
                    break;

                case "JIYUANNRSHSUB":
                    entity = new EntityJiyuanNRSHSub();
                    break;

                case "JIYUANXMSH":
                    entity = new EntityJiyuanXMSH();
                    break;

                case "JIYUANXMSHSUB":
                    entity = new EntityJiyuanXMSHSub();
                    break;

                case "ZHIFADW":         // 执法单位
                    entity = new EntityZhifaDW();
                    break;

                default:
                    ExceptionHelper.Throw404Exception();
                    break;
            }

            return entity;
        }
    }
}
